home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / Form & Validation / max-of-chars-check-2.izs < prev    next >
Text File  |  2005-08-29  |  1KB  |  59 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>Max # of characters check 2
  4. <!/TITLE>
  5.  
  6. <!DESCRIPTION>A script that checks the number of characters in a form box, and if it exceeds the predetermined number, cancels the form submission, and asks the surfer to reenter data.
  7.  
  8. <!/DESCRIPTION> 
  9.  
  10. <!CATEGORY>form and form validation<!/CATEGORY>
  11.  
  12. <!SCRIPT>
  13. <!-- START OF SCRIPT -->
  14. <script>
  15. <!--
  16.  
  17. function checkchars(cur){
  18. //change max length to determine below
  19. var maxlength=50
  20. if (cur.chars.value.length>maxlength){
  21. alert("Please restrain your input to 50 or less characters!")
  22. return false
  23. }
  24. }
  25. //-->
  26. </script>
  27.  
  28. <form onsubmit="return checkchars(this)">
  29. <strong>In 50 chars or less, please type a short description of yourself:</strong><br><textarea rows="5" cols="38" name="chars"></textarea>
  30. <br><input type="submit" value="Submit!">
  31. </form>
  32. <!-- END OF SCRIPT -->
  33. <!/SCRIPT>
  34.  
  35. <!PREVIEW>
  36. <!-- START OF SCRIPT -->
  37. <script>
  38. <!--
  39.  
  40. function checkchars(cur){
  41. //change max length to determine below
  42. var maxlength=50
  43. if (cur.chars.value.length>maxlength){
  44. alert("Please restrain your input to 50 or less characters!")
  45. return false
  46. }
  47. }
  48. //-->
  49. </script>
  50.  
  51. <form onsubmit="return checkchars(this)">
  52. <strong>In 50 chars or less, please type a short description of yourself:</strong><br><textarea rows="5" cols="38" name="chars"></textarea>
  53. <br><input type="submit" value="Submit!">
  54. </form>
  55.  
  56. <!-- END OF SCRIPT -->
  57. <!/PREVIEW>
  58.  
  59. <!RELATED>NONE<!/RELATED>